/**
 * Copyright &copy; 2020 <a href="https://github.com/somowhere/exam-system">exam-system</a> All rights reserved.
 */
package com.shanhesoft.java.modules.exam.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shanhesoft.java.common.core.vo.PageModel;
import com.shanhesoft.java.common.data.util.QueryWrapperUtil;
import com.shanhesoft.java.common.persistence.datascope.DataScope;
import com.shanhesoft.java.common.persistence.service.impl.DataServiceImpl;
import com.shanhesoft.java.modules.exam.domain.Course;
import com.shanhesoft.java.modules.exam.domain.dto.CourseDto;
import com.shanhesoft.java.modules.exam.domain.dto.CourseQueryCriteria;
import com.shanhesoft.java.modules.exam.domain.vo.CourseVo;
import com.shanhesoft.java.modules.exam.repository.CourseRepository;
import com.shanhesoft.java.modules.exam.service.CourseService;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 课程管理ServiceImpl 课程管理
 * @author admin
 * @version 2020-09-23 19:34:44
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class CourseServiceImpl extends DataServiceImpl<CourseRepository, Course, CourseDto, String> implements CourseService{
	@Override
	public void saveOrUpdate(CourseDto courseDto) {
		super.saveOrUpdate(courseDto);
	}

	/**
	 * 分页查询考试记录
	 *
	 * @param pm 分页对象
	 * @return
	 */
	@Override
	public IPage<CourseVo> findPage(PageModel pm, CourseQueryCriteria courseQueryCriteria) {
		QueryWrapper wrapper = QueryWrapperUtil.getWrapper(pm, courseQueryCriteria);
		IPage<CourseVo> paperVoIPage = repository.findCourseVoPage(pm, wrapper);
		return paperVoIPage;
	}

	/**
	 * 查询考试记录对象
	 * @param id
	 * @return
	 */
	@Override
	public CourseVo findCourseVoById(String id) {
		CourseVo examRecordVo = baseMapper.findCourseVoById(id);

		return examRecordVo;
	}
}
